﻿@model OnlineMealOrdering.Models.AccountModel

@{
    ViewBag.Title = "注册";
}
<link href="~/Content/themes/base/jquery.ui.all.css" rel="stylesheet" />
<script src="~/Scripts/jquery-ui-1.8.20.js"></script>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jqueryval")
<script src="~/Scripts/webCommon.js"></script>
<script type="text/javascript">
    function Success(e) {
        debugger;
        if (e == "succees") {
            registerSuccees();
        } else {
            $("#myyzm").val("");
            MessageShow("info", "提示", e);
        }
    }
    function existsUser() {
        var usercode = $("#userCode").val();

    }
    function Failure(e) {
        MessageShow("error", "提示", "网络错误请重新提交...");
    }
    function Complete(e) {

    }
    function Begin() {

    }
    var i = 3;
    function gotoindex() {
        var go = $("#gotoindex");
        go.text(i);
        if (--i == 0) {
            window.clearInterval(mytime);
            window.location.href = "/Home/Index";
        }
    }
    var mytime;
    //注册成功提示跳转首页
    function registerSuccees() {
        $(".reg-left02").html("");
        $(".reg-left02").append("<div id='regsuccees'><span>恭喜您，注册成功!<br/><br/></span><span id='gotoindex'>5</span>秒后跳转到首页...</div>");
        mytime = window.setInterval("gotoindex()", 1000);
    }

</script>

<div class="login-main">
    <h3>注册U虎帐号</h3>
    <div class="reg-left02">

        <div class="login-tab">
            <a class="current" href="javascript:void(0);"><span class="em"></span>在线注册</a>
            <a href="/account/signmobile/"><span class="ph"></span>手机注册</a>
        </div>
        <div class="login-tabcen">
            @using (Ajax.BeginForm("Register", new AjaxOptions
            {
                HttpMethod = "Post",
                OnSuccess = "Success",
                OnFailure = "Failure",
                OnComplete = "Complete",
                OnBegin = "Begin"
            }))
            {
                <table style="position: relative;" class="lotab mb110 emailtd">
                    <tbody>
                        <tr>
                            <th>
                                @Html.LabelFor(a => a.Name)
                            </th>
                            <td>
                                @Html.TextBoxFor(a => a.Name, new { @class = "myinput", id = "name" })
                                @Html.ValidationMessageFor(a => a.Name)
                            </td>
                        </tr>
                        <tr>
                            <th>
                                @Html.LabelFor(a => a.UserCode)
                            </th>
                            <td>
                                @Html.TextBoxFor(a => a.UserCode, new { @class = "myinput", autocomplete = "off", id = "userCode" })
                                <a href="javascript:void(0)" onclick="existsUser()">检测</a>
                                <span class="succeedusergreen">√可以注册.</span>
                                @Html.ValidationMessageFor(a => a.UserCode)
                            </td>
                        </tr>
                        <tr>
                            <th>
                                @Html.LabelFor(a => a.Password)
                            </th>
                            <td>
                                @Html.PasswordFor(a => a.Password, new { @class = "myinput", id = "pwd" })
                                @Html.ValidationMessageFor(a => a.Password)
                            </td>
                        </tr>
                        <tr>
                            <th>
                                @Html.LabelFor(a => a.ConfirmPassword)
                            </th>
                            <td>
                                @Html.PasswordFor(a => a.ConfirmPassword, new { @class = "myinput", id = "pwd2" })
                                @Html.ValidationMessageFor(a => a.ConfirmPassword)
                            </td>
                        </tr>
                        <tr>
                            <th>
                                <label>地址：</label>
                            </th>
                            <td>
                                <select id="add_province" name="Area" class="mysele01" style="visibility: inherit;">
                                    <option selected="selected" value="34">虎门</option>
                                </select>
                                <select id="add_city" name="Address" class="mysele02" style="visibility: inherit;">
                                    <option selected="selected" value="0">虎门广场</option>
                                    <option selected="selected" value="0">虎门商业区</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>
                                @Html.LabelFor(a => a.Question)
                            </th>
                            <td>                               
                                @Html.DropDownListFor(a=>a.Question,ViewData["DeliveryTypeList"] as IEnumerable<SelectListItem>) 
                            </td>
                        </tr>
                        <tr>
                            <th>
                                @Html.LabelFor(a => a.Answer)
                            </th>
                            <td>
                                @Html.TextBoxFor(a => a.Answer, new { @class = "myinput", id = "answer" })
                                @Html.ValidationMessageFor(a => a.Answer)
                            </td>
                        </tr>
                        <tr>
                            <th>
                                @Html.LabelFor(a => a.VCode)
                            </th>
                            <td>
                                @Html.TextBoxFor(a => a.VCode, new { style = "ime-mode: disabled;", maxlength = "4", @class = "myinput yzm", id = "myyzm" })
                                @Html.ValidationMessageFor(a => a.VCode)
                                <img width="74" height="32" src="/Account/GetValidateCode" class="yzmimg" onclick="changeimg()">
                                <a id="changeChkimg" href="javascript:changeimg()">看不清楚？换一张</a>
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <div id="xieyidiv" class="login-ck mt8">
                                    <input type="checkbox" checked="" value="1" class="chk01" id="chk02" name="xieyi">
                                    <label for="chk02" class="chkt03">我已看过并同意<a target="_blank" href="#">《U虎外卖网用户协议》</a></label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input type="submit" value="同意协议并注册" name="sub" id="zhucebtn" class="mybut longbut">
                            </td>
                        </tr>
                    </tbody>
                </table>
            }
        </div>

    </div>
    <div class="login-right">
        <p>已有U虎帐号？</p>
        <a class="abut01" href="@Url.Action("login","Account")"><span>登&nbsp;陆</span></a>
    </div>
    <div class="clr"></div>
</div>

